﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace mogco.Visuals
{
    public partial class AddNewResolution : Form
    {
        public AddNewResolution()
        {
            InitializeComponent();
        }

        public Point GetNewResolution
        {
            get;
            set;
        }

        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text.Length != 0 && textBox2.Text.Length != 0)
            {
                try
                {
                    int height = Convert.ToInt16(textBox1.Text);
                    int width = Convert.ToInt16(textBox2.Text);
                    if (width < 16 || height < 16 ||
                        width > 2000 || height > 2000
                       )
                        throw new System.FormatException();
                    GetNewResolution = new Point(Convert.ToInt16(textBox1.Text), Convert.ToInt16(textBox2.Text));
                    DialogResult = DialogResult.OK;
                }
                catch (Exception e1)
                {
                    Logger.txtLogger.WriteMessage("{0} Error saving new resolution." + e1);
                }
            }
        }

        private void button2_Click(object sender, EventArgs e)
        {
            this.Close();
        }


    }
}
